package com.xja.dubbo.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xja.dubbo.entity.Easybuy_product_comment;
import com.xja.dubbo.mapper.Easybuy_product_commentMapper;
import com.xja.dubbo.service.ProductCommentService;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * @author ycz
 * @create 2021-12-18-15:00
 */
@Component
@Service(interfaceClass = ProductCommentService.class)
public class ProductCommentServiceImpl implements ProductCommentService {

    @Autowired
    private Easybuy_product_commentMapper easybuy_product_commentMapper;

    @Override
    public PageInfo<Easybuy_product_comment> selectCommentById(Integer id,Integer pageNum) throws Exception {
        PageHelper.startPage(pageNum, 3);
        List<Easybuy_product_comment> list = easybuy_product_commentMapper.selectCommentById(id);
        PageInfo<Easybuy_product_comment> pageInfo = new PageInfo<>(list);

        return pageInfo;

    }

    @Override
    public Map<String, Object> selectLevelCommentNumByPid(Integer id) {

        Map<String, Object> commMap = easybuy_product_commentMapper.selectLevelCommentNumByPid(id);


        return commMap;
    }
}
